/*******************************************************************************
 * Copyright (c) 2011 EclipseDevX.org and others.
 * 
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at:
 * 
 *     http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package org.eclipsedevx.appengine.usage;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;

/**
 * 
 */
public class ReportGenerator {
	public static final String FILE_NAME = "usagereport.html";

	private List<User> users;
	
	private HtmlWriter out;
	
	public ReportGenerator(List<User> users) {
		this.users = users;
	}

	public String generateReport() {
		StringWriter writer = new StringWriter();
		
		out = new HtmlWriter("Eclipsedevx Usage", new PrintWriter(writer), "../");
		
		out.writePageTitle("Eclipsedevx Usage");
		
		out.writeTableTitle("7 day active users");
		out.startTag("p");
		out.println(users.size() + " users");
		out.endTag();
		
		out.close();
		
		return writer.toString();
	}

}
